// This file is part of Indico.
// Copyright (C) 2002 - 2025 CERN
//
// Indico is free software; you can redistribute it and/or
// modify it under the terms of the MIT License; see the
// LICENSE file for more details.

@use 'rb:styles/palette' as *;
@use 'rb:styles/util' as *;

.legend {
  display: flex;
  justify-content: space-between;

  &:not(.compact) {
    padding: 1em 0 !important;
  }

  &.compact {
    flex-direction: column;
  }

  .labels {
    &.compact {
      display: flex;
      align-items: center;
    }

    :global(.label) {
      color: white;
      font-weight: bold;
      border: 1px solid rgba(0, 0, 0, 0.1);
      padding-top: 0.7em;
      padding-bottom: 0.7em;

      &.compact {
        padding: 0.5em;
        border: 1px solid rgba(0, 0, 0, 0.2);

        & + .text {
          padding-left: 0.25em;
        }
      }

      &.available {
        background-color: $available-color;
      }

      &.conflicting-candidate {
        background-color: $conflicting-candidate-color;
      }

      &.booking {
        background-color: $booking-color;
      }

      &.conflict {
        background-color: $conflict-color;
      }

      &.pre-booking {
        @include stripes($pre-booking-stripe-colors...);
        color: $pre-booking-label-color;
      }

      &.pre-booking-conflict {
        @include thiner-stripes($pre-booking-conflict-stripe-colors...);
      }

      &.concurrent-pre-booking {
        @include thiner-stripes($pre-booking-concurrent-stripe-colors...);
        color: darken($pre-booking-color, 30%);
      }

      &.cancellation {
        background-color: $cancellation-color;
        border: 1px solid darken($cancellation-color, 15%);
        color: darken($cancellation-color, 40%);
      }

      &.unbookable {
        @include thin-stripes($unbookable-stripe-colors...);
        background-size: 35px 35px;
        border: 1px solid $unbookable-color;
        color: darken($unbookable-color, 40%);
      }

      &.pending-cancellation {
        background-color: $pending-cancellation-color;
      }

      &.blocking {
        @include thin-stripes($blocking-stripe-colors...);
        background-size: 35px 35px;
        border: 1px solid lighten($conflict-color, 20%);
        color: darken($conflict-color, 10%);
      }

      &.overridable-blocking {
        @include thin-stripes($overridable-blocking-stripe-colors...);
        background-size: 35px 35px;
        border: 1px solid $overridable-blocking-color;
        color: darken($overridable-blocking-color, 20%);
      }

      &.rejection {
        background-color: $rejection-color;
        border: 1px solid darken($rejection-color, 25%);
        color: darken($rejection-color, 40%);
      }

      &.other {
        background-color: $other-booking-color;
        border: 1px solid darken($other-booking-color, 25%);
      }
    }
  }
}
